#ifndef _main__h
#define __main_h
//HAL--------------------



//Const--------------------
//base 4ms
#define D_1s         250   //1s
#define D_40ms       10    //40ms
#define D_300ms   75 //300ms
#define D_500ms      125     //500ms
 #define D_1m        60

 
#define	F_setPowerL		P1_2=1
#define	F_clrPowerL		P1_2=0
         
#define	F_setPowerH		P1_3=1
#define	F_clrPowerH		P1_3=0
 
 
 #define setKaiGuanLed  P1_7=1
 #define clrKaiGuanLed  P1_7=0
 
 #define setOrtherLed  P3_3=1;P1_6=1;
 #define clrOrtherLed  P3_3=0;P1_6=0;
 
#define D_keyKaiGuan 1
#define D_keySheZhi 2
#define D_keyYuYue 3
#define D_keyUp   4
#define D_keyDown  5
 
//Var----------------------
#ifdef  MAIN_C
uint8_t  data timer1s;
	uint8_t data   timer40ms; 
	uint8_t data  timer300ms;
	uint8_t data   timer500ms; 
	uint8_t  data timer1m;
 uint8_t  data  keyValue;
uint8_t  data longKeyHoldTime;
uint8_t data  longKeyValue;
uint8_t data  holdKey;
uint8_t  data longKeyJudgeTime;
bit  data  bStart;
bit data  bSecFlash500ms;


bit bError;
uint8_t setCurTemp;
uint8_t mainClockHour;
uint8_t mainClockMin;
uint8_t reShuiLiang;
bit bSuReOrJieNeng;
uint8_t yuYueNum;
uint8_t flashYuYue;
uint8_t flashMoShi;
uint8_t moShiNum;
uint8_t  orderClockOpenHour;
uint8_t   orderClockOpenMin;
uint8_t   orderClockCloseHour;
uint8_t   orderClockCloseMin;
bit bSaveTemp;
bit bOrderOpen;
bit bOrderClose;
bit bPowerOnOff;
bit delaySetPowerH;
bit bFengGuYeDian;
uint8_t timer500msOther;
#else
extern uint8_t timer500msOther;
extern bit bFengGuYeDian;
extern bit bPowerOnOff;
extern bit delaySetPowerH;
extern bit bError;
extern uint8_t setCurTemp;
extern uint8_t mainClockHour;
extern uint8_t mainClockMin;
extern uint8_t reShuiLiang;
extern bit bSuReOrJieNeng;
extern uint8_t yuYueNum;
extern uint8_t flashYuYue;
extern uint8_t flashMoShi;
extern uint8_t moShiNum;
extern uint8_t  orderClockOpenHour;
extern uint8_t   orderClockOpenMin;
extern uint8_t   orderClockCloseHour;
extern uint8_t   orderClockCloseMin;
extern bit bSaveTemp;
extern bit bOrderOpen;
extern bit bOrderClose;
extern uint8_t  data timer1s;
extern 	uint8_t data   timer40ms; 
extern 	uint8_t data  timer300ms;
extern 	uint8_t data   timer500ms; 
extern 	uint8_t  data timer1m;
extern  uint8_t  data  keyValue;
extern uint8_t  data longKeyHoldTime;
extern uint8_t data  longKeyValue;
extern uint8_t data  holdKey;
extern uint8_t  data longKeyJudgeTime;
extern bit  data  bStart;
extern bit data  bSecFlash500ms;
#endif


//Function----------------------
void	remKey();
void OrderOpen();
void PowerSet();
void setMoShi();
void setYuYue();
void timerControl();
 void keyMoShi();
void getKey();
void keyKaiGugan();
    void   keySheZhi();
void keyYuYue();
void keyUp();
void keyDown();
void PowerOff();
 void Error();
#endif